package io.renren.modules.blog.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.blog.dao.BlogArticleDao;
import io.renren.modules.blog.dto.BlogArticleDTO;
import io.renren.modules.blog.entity.BlogArticleEntity;
import io.renren.modules.blog.service.BlogArticleService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 文章管理
 *
 * @author www.jianglongwang.com wangjianglong126@126.com
 * @since 2.0.0 2020-05-21
 */
@Service
public class BlogArticleServiceImpl extends CrudServiceImpl<BlogArticleDao, BlogArticleEntity, BlogArticleDTO> implements BlogArticleService {

    @Override
    public QueryWrapper<BlogArticleEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");

        QueryWrapper<BlogArticleEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);
        wrapper.eq("status", 1); //已发布

        return wrapper;
    }


}